<%= tr8n_with_options_tag(:default_locale => Tr8n::Config.default_admin_locale, :admin => true) do %>

  <%= render :partial => "/tr8n/common/header" %>
  
  <div class="section_title">
    <%= render :partial => "/tr8n/translator/sections" %>
    <%=tra("Your Following") %>
  </div>

  <div class="section_title">
    <%= tra("Translators") %>
  </div>

  <div class="section grey" style="margin-top:10px; margin-bottom:10px; padding:10px;">
    <% if @translators.empty? %>
      <%=tra("You are not following any translators") %>

    <% else %>

      <table style="width:100%;" cellpadding="5">
        <tr style="border-bottom: 1px solid black;">
          <th style="width:200px;color:grey;"><%=tra('Name', 'Awards section header')%></th>
          <th style="text-align:right;color:grey;"><%=tra('Total Translations', 'Awards section header')%></th>
          <th style="text-align:right;color:grey;"><%=tra('Total Votes', 'Awards section header')%></th>
        </tr>
        
        <% @translators.each_with_index do |t, index| %>
          <% style = "border-bottom: 1px dotted #ccc;" unless @translators.last == t %>
          <tr style="<%=style%>">
            <td>
              <table>
                <tr>
                  <td style="vertical-align:top;padding:5px;">
                    <%=tr8n_translator_mugshot_tag(t, :linked => true)%>
                  </td>
                  <td style="vertical-align:top;padding:5px;">
                    <%=tr8n_translator_tag(t, :linked => true)%>
                  </td>
                </tr>
              </table>        
            </td>
            <td style="text-align:right;padding:5px;">
              <%=t.total_metric.total_translations%>
            </td>
            <td style="text-align:right;padding:5px;">
              <%=t.total_metric.total_votes%>
              (<span style="color:green" title="<%=trla('Number of positive votes', 'Awards section header')%>"><%=t.total_metric.positive_votes || 0 %></span>/<span style="color:red" title="<%=trla('Number of negative votes', 'Awards section header')%>"><%=t.total_metric.negative_votes || 0 %></span>)
            </td>
          </tr>
        <% end %>
      </table>
    <% end %>
  </div>

  <div class="section_title">
    <%= tra("Phrases") %>
  </div>

  <div class="section " style="margin-top:10px; margin-bottom:10px; padding:10px;">
    <% if @translation_keys.empty? %>
      <%=tra("You are not following any phrases") %>
    <% else %>  
      <table style="width:100%">
        <tr style="border-bottom:2px solid #ccc;">
           <td style="width:30%;padding:5px; background: #f9f8f7; font-size:16px; color:grey; ">
             <%=tra("Original Phrase")%>
           </td>
           <td style="width:70%;padding:5px; font-size:16px; color:grey; " colspan="2">
             <%=tra("Top Translations") %>
           </td>
        </tr>  
        <% @translation_keys.each do |tk| %>
          <tr style="border-bottom:1px solid #ccc;">
            <% color = tk.can_be_translated? ? "#FDFDDF" : "#ECFFEF" %>
            <td style="padding:5px; background: <%=color%>; " dir="ltr">
              <% unless tk.can_be_translated? %>
                <div style="<%=tr8n_style_attribute_tag('float', 'right')%>"><%=image_tag("/tr8n/images/lock.png", :style=>"width:12px", :title => trla("This phrase is locked"))%></div>
              <% end %>
              <%=link_to(tk.default_decoration, :action => :view, :translation_key_id => tk.id, :section_key => @section_key)%>
              <div style="color:grey;font-size:10px;padding-top:3px;" dir="ltr"><%=tk.description%></div>
            </td>
            <td style="padding:5px; vertical-align:top">
              <div id="tr8n_translator_votes_for_<%=tk.key%>">
              <% translations = tk.translations_for(nil) %>
              <% if translations.empty? %>
                <%= tra("There are no translations for this phrase.") %> 
                <% if tk.can_be_translated? %>
                  <%= tra("Be the first one to [link: translate it].", "", 
                          :link => lambda{|str| link_to(str, :controller => "/tr8n/phrases", :action => :view, :translation_key_id => tk.id, :section_key => @section_key)}  ) %>
                <% end %>       
              <% else %>   
                <%= render :partial => "/tr8n/common/translation_votes", :locals => {:flag => true, :translation_key => tk, :translations => translations[0..4], :section_key => @section_key} %>
              <% end %> 
              </div>  
            </td>
          </tr>
        <% end %>
      </table>
    <% end %>
  </div>

  <%= render :partial => "/tr8n/common/footer" %>

<% end %>  